﻿@{
    ViewBag.Title = "编辑栏目";
    var channel = ViewBag.channel as HynuIOTA.Entity.Channel;
}
@section scripts
{
    <script>
        function doBegin() {
            window.top.$.msgBoxObj.showMsgInfo('正在提交数据....');
        }

        function doFail() {
            window.top.$.msgBoxObj.showMsgErr('网络异常!');
        }

        function doComplete(xhrObj) {
            $.processJsonMsg(xhrObj.responseText,
                function(response) {
                    if (response.Statu === 1) {
                        window.top.topHelper.closeComWindow();
                        window.top.topHelper.updateDataGrid();
                    }
                });
        }

        // 初始化控件
        function initControl() {
            $('#Channels').combobox({
                panelHeight: 200,
                hasDownArrow: true,
                valueField: 'id',
                textField: 'text',
                url: '@Url.Action("GetParentChannelList", "Channel", new {area = "Admin"})',
                loadFilter: function(data) {
                    data.Data.push({id:'' , text:'无'});
                    return data.Data;
                }
            });
        }

        $(function() {
            initControl();
            $('#IsPage').combobox({
                panelHeight: 70,
                hasDownArrow: true,
                valueFeild: 'value',
                textFeild: 'text',
                data: [{ value: true, text: '是单页', selected: true }, { value: false, text: '不是单页' }]
            });
        });
    </script>
}
@section headSection
{
    <style>
        #news-form {
            margin-top: 40px;
        }

            #news-form .input-div {
                margin: 20px;
                display: block;
            }
    </style>
}
<div>
    @using (Ajax.BeginForm("PutChannel", new { area = "Admin", controller = "Channel" }, new AjaxOptions()
    {
        HttpMethod = "Put",
        OnBegin = "doBegin",
        OnFailure = "doFail",
        OnComplete = "doComplete"
    }, new { id = "news-form", name = "news-form" }))
    {
        <input type="hidden" name="Id" value="@channel.Id"/>
        <div class="input-div"><input id="Name" name="Name" value="@channel.Name" class="easyui-textbox" data-options="label:'名称：',labelPosition:'left',labelWidth:100," style="width: 95%; height: 30px;"></div>
        <div class="input-div"><input id="Link" name="Link" value="@channel.Link" class="easyui-textbox" data-options="label:'链接：',labelPosition:'left',labelWidth:100," style="width:95%; height: 30px;"></div>
        <div class="input-div"><input id="Description" name="Description" value="@channel.Description" class="easyui-textbox" data-options="label:'描述：',labelPosition:'left',labelWidth:100," style="width: 95%; height: 30px;"></div>
        <div class="input-div"><input id="IsPage" name="IsPage" class="easyui-textbox" value="@channel.IsPage" data-options="label:'是否单页：',labelPosition:'left',labelWidth:100," style="width: 95%; height: 30px;"></div>
        <div class="input-div"><input id="Channels" name="ParentId" class="easyui-textbox" value="@channel.ParentId" data-options="label:'父栏目：',labelPosition:'left',labelWidth:100," style="width: 95%; height: 30px;"></div>
        <div class="input-div"><input id="Seq" name="Seq" class="easyui-textbox" value="@channel.Seq" data-options="label:'排序：',labelPosition:'left',labelWidth:100," style="width: 95%; height: 30px;"></div>
        <div class="input-div">
            <input type="submit" class="easyui-linkbutton button-blue l-btn l-btn-small" name="submit" style="width: 46px; height: 30px; margin: 10px" value="提交" />
            <input type="reset" class="easyui-linkbutton button-red l-btn l-btn-small" style="width: 46px; height: 30px; margin: 10px" name="reset" value="重置" />
        </div>
    }
</div>